package ctn.hibernate.po;

// Generated 2011-12-8 2:29:36 by Hibernate Tools 3.2.4.GA

import static javax.persistence.GenerationType.IDENTITY;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * CtnGrp generated by hbm2java
 */
@Entity
@Table(name = "ctn_grp", catalog = "cpa")
public class CtnGrp implements java.io.Serializable {

	private Long id;
	private String grpName;
	private Set<CtnCpaVer> ctnCpaVersForImplGrpId = new HashSet<CtnCpaVer>(0);
	private Set<CtnCpaVer> ctnCpaVersForWatchGrpId = new HashSet<CtnCpaVer>(0);
	private Set<CtnUser> ctnUsers = new HashSet<CtnUser>(0);

	public CtnGrp() {
	}

	public CtnGrp(Long id, String grpName) {
		this.id = id;
		this.grpName = grpName;
	}

	public CtnGrp(Long id, String grpName,
			Set<CtnCpaVer> ctnCpaVersForImplGrpId,
			Set<CtnCpaVer> ctnCpaVersForWatchGrpId, Set<CtnUser> ctnUsers) {
		this.id = id;
		this.grpName = grpName;
		this.ctnCpaVersForImplGrpId = ctnCpaVersForImplGrpId;
		this.ctnCpaVersForWatchGrpId = ctnCpaVersForWatchGrpId;
		this.ctnUsers = ctnUsers;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ID", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "GRP_NAME", nullable = false, length = 10)
	public String getGrpName() {
		return this.grpName;
	}

	public void setGrpName(String grpName) {
		this.grpName = grpName;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "ctnGrpByImplGrpId")
	public Set<CtnCpaVer> getCtnCpaVersForImplGrpId() {
		return this.ctnCpaVersForImplGrpId;
	}

	public void setCtnCpaVersForImplGrpId(Set<CtnCpaVer> ctnCpaVersForImplGrpId) {
		this.ctnCpaVersForImplGrpId = ctnCpaVersForImplGrpId;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "ctnGrpByWatchGrpId")
	public Set<CtnCpaVer> getCtnCpaVersForWatchGrpId() {
		return this.ctnCpaVersForWatchGrpId;
	}

	public void setCtnCpaVersForWatchGrpId(
			Set<CtnCpaVer> ctnCpaVersForWatchGrpId) {
		this.ctnCpaVersForWatchGrpId = ctnCpaVersForWatchGrpId;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "ctn_user_grp", catalog = "cpa", joinColumns = { @JoinColumn(name = "GRP_ID", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "USER_ID", nullable = false, updatable = false) })
	public Set<CtnUser> getCtnUsers() {
		return this.ctnUsers;
	}

	public void setCtnUsers(Set<CtnUser> ctnUsers) {
		this.ctnUsers = ctnUsers;
	}

}
